﻿using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            //            1.定义两个存放(int)的集合，集合listA {“a”,”b”,”c”,”d”,”e”}
            //            listB {“d”,”e”,”f”,”g”,”h”},
            //将这两个集合去除重复项后合并成一个集合。

            List<string > listA = new List<string >();
            List<string> listB = new List<string>();
            listA.AddRange(new string   [] { "a","b","c","d","e"});
            listB.AddRange(new string[] { "d", "e", "f", "g", "h" });
            for (int i = 0; i < listB.Count; i++)
            {
                if (listA.Contains(listB [i])==false ) 
                {
                    listA.Add(listB [i]);
                }
            }
            Console.WriteLine(string .Join (" ",listA ));
            //2.计算字符串中每种字符出现的次数:  my name is kiki, kiki, kiki ,kiki.

            //3.将1 2 3转换成 壹贰叁
            int[] arr = new int[] {1,2,3 };

            //4.分拣奇偶数 int[]{ 1,2,3,4,5,6,7,8,9}
            //            将
            List<int> listD = new List<int>( new int [] { 1, 2, 3, 4, 5, 6, 7, 8, 9 } );
            List<int> listE = new List<int>(new int [] { 1, 2, 3, 4, 5, 6, 7, 8, 9 });
            for (int i = 0; i < listD .Count ; i++)
            {
                if (listD[i] % 2 == 0)
                {
                    listD.RemoveAt(i);
                  
                }
                
            }
            for (int i = 0; i < listE.Count; i++)
            {
                if (listE[i] % 2 != 0)
                {
                    listE.RemoveAt(i);

                }

            }

            Console.WriteLine("奇数:");
            foreach (var item in listD )
            {
                Console.Write(" "+ item );
            }
            Console.WriteLine("\n偶数");
            foreach (var item in listE)
            {
                Console.Write(" "+item);
            }

        }
    }
}
